package com.jar.exercise.多线程.线程池;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class SpringThread {
	public static void main(String[] args) {
		//设置最大线程数5个
		//设置池中核心数量是2
		ScheduledExecutorService mScheduledThreadPool = Executors.newScheduledThreadPool(2);
		System.out.println("现在的时间:" + System.currentTimeMillis());
		mScheduledThreadPool.schedule(() -> {
			// TODO Auto-generated method stub
			System.out.println("现在的时间:" + System.currentTimeMillis());

		}, 4, TimeUnit.SECONDS);//这里设置延迟4秒执行
	}
}
